﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace ReklamaWPF
{
    /// <summary>
    /// Interaction logic for BlockAdd.xaml
    /// </summary>
    public partial class BlockAdd : Window
    {
        public bool red = false;

        public BlockAdd()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (!red)
                {
                    if (Functionality.insertBlockIntoDB(this))
                    {
                        DialogResult = true;
                        Close();
                    }
                    else
                    {
                        MessageBox.Show("Klaida įvedamuose duomenyse!");
                    }
                }
                else
                {
                    DialogResult = true;
                    Close();
                }

            }
            catch (Exception ex) { MessageBox.Show("Klaida įvedamuose duomenyse!"); return; }
        }

        private void button2_Click(object sender, RoutedEventArgs e)
        {
            DialogResult = false;
            Close();
        }
    }
}
